package com.yorick.authority.dao;

import com.yorick.authority.entitys.BaseListDto;
import com.yorick.authority.entitys.DeleteChildDepartmentDto;
import com.yorick.authority.entitys.DepartmentDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface DepartmentMapper {

    //插入新的机构
    void insertDepart(DepartmentDto data);

    //根据账号查询机构列表
    List<DepartmentDto> findDepartmentList(BaseListDto data);

    //修改机构信息
    void updateDepartment(DepartmentDto data);

    List<Integer> removedChildByParentID(DeleteChildDepartmentDto data);

    //查询用户所属机构
    List<Integer> findDepartmentByAID(int aid);

    //根据机构ID查询机构详情及子机构
    List<DepartmentDto> findDepartmentByDID(@Param("dids") List<Integer> dids);

    //调用存储过程实现无限层级递归查询子机构
    List<Integer> findChildrenByDID(int did);

    //删除机构及其子机构和其他关联
    void deleteDepartmentByDID(@Param("dids") List<Integer> dids);
}
